
const mysql = require('./mysql');

let getAllInterests = async function () {
    let sql = `select * from interests`;
    return await mysql.asyncExec(sql);
}

let getAllname = async function(){
    let sql = `select name from interests`;
    return await mysql.asyncExec(sql);
}

let intertEntries = async function (name, topic_num) {
    name = name.replace(/'/g, name);
    let sql = `insert into interests(name,topic_num) values('${name}',${topic_num});`;
    return await mysql.asyncExec(sql);
}

module.exports = {
    getAllInterests,
    getAllname,
    intertEntries
}